import Vue from 'vue'
import VMessage from './VMessage'

VMessage.newInstance = () => {
  const vm = new Vue({
    render: function(h) {
      return h(
        VMessage,
        null,
        null
      )
    }
  })

  const component = vm.$mount()
  document.body.appendChild(component.$el)

  const vMessageComponent = vm.$children[0]

  return {
    add(notice) {
      vMessageComponent.add(notice)
    }
  }
}

export default VMessage
